<include file="Public/header" title="寄件列表" />
<body onselectstart="return false">
<div class="main">
    <div class="content">
        <div class="head-content">
            <div class="head-title">寄件列表</div>
            <div class="head-search">
                <a href="<{:U('add')}>" class="form-button color-bg-yellow" >添加</a>
            </div>
        </div>
    </div>
    <div class="content">
        <div class="head-content">
            <form action="<{:U('index')}>" method='get'>
                <div class="head-search">
                    <input class="form-input-small" type="text" value="<{:I('get.no')}>" name='no' placeholder="编号" />
                    <input class="form-input-small" type="text" value="<{:I('get.phone')}>" name='phone' placeholder="手机号" />
                    <input class="form-input-small" type="text" value="<{:I('get.name')}>" name='name' placeholder="姓名" />
                    <button class="form-button color-bg-green">搜索</button>
                    <button onclick="deliver();return false;" class="form-button color-bg-green">发货</button>
                </div>
            </form>
        </div>
    </div>
    <div class="table-list">
        <table cellpadding="0" cellspacing="0" style="table-layout: fixed">
            <thead>
            <tr>
                <th>快件编号</th>
                <th>寄件人姓名</th>
                <th>寄件人电话</th>
                <th>寄件人地址</th>
                <th>收件人姓名</th>
                <th>收件人电话</th>
                <th>收件人地址</th>
                <th>发货状态</th>
               
                <th>快件重量</th>
                <th>寄件来源</th>
                <th>价格</th>
				 <th>支付方式</th>
                <th>操作</th>
            </tr>
            </thead>
            <foreach name='list' item='vo'>
                <tr >
                    <td>
                            <{$vo['no']}>
                    </td>
                    <td><{$vo['sender_name']|default='-'}></td>
                    <td><{$vo['sender_phone']|default='-'}></td>
                    <td class="dizhi" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" ><{$vo['sender_province']['name']}> <{$vo['sender_city']['name']}> <{$vo['sender_county']['name']}> <{$vo['sender_town']['name']}> <{$vo['sender_village']['name']}><{$vo['sender_addr']}></td>
                    <td><{$vo['accept_name']|default='-'}></td>
                    <td><{$vo['accept_phone']|default='-'}></td>
                    <td class="dizhi" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" ><{$vo['accept_province']['name']}> <{$vo['accept_city']['name']}> <{$vo['accept_county']['name']}> <{$vo['accept_town']['name']}> <{$vo['accept_village']['name']}><{$vo['accept_addr']}></td>
                    <td>
                        <if condition="$vo['status']">
                            <{$vo['status']|get_take_status}>
                            <else />
                            <button onclick="writer_no(<{$vo['id']}>)"  style="color: #fff;border-radius: 3px;outline: none;border: none;height: 23px;width: 65px;cursor: pointer" class="color-bg-green">收到寄件</button>
                        </if>

                    </td>
                    <td><{$vo['weight']}>kg</td>
                    <td><{$vo['is_ren']|get_post_from}></td>
                    <td><{$vo['price']}>元</td>
					<td><{$vo['pay_state']|get_pay_status}></td>
                    <td>
                        <div class="operate-list">
							<if condition="!$vo['status']">
							<a class="heart" title='修改' href="javascript:void(0)" onclick="layer.tips('请确认收到寄件',this)">
                                <i class="iconfont">&#xe64f;</i>
                            </a>
							<else/>
							 <a class="heart" title='修改' href="<{:U('edit',array('id'=>$vo['id']))}>">
                                <i class="iconfont">&#xe64f;</i>
                            </a>
							</if>
                           
                            <a class="delete" title='删除' onclick="info(<{$vo['id']}>)" href="javascript:void(0)">
                                <i class="iconfont">&#xe62b;</i>
                            </a>
                        </div>
                    </td>
                </tr>
            </foreach>
        </table>

        <!--没有结果时显示-->
        <if condition="!$list" >
            <div class="nodata"><i class="iconfont">&#xe607;</i><span>没有查询到符合条件的记录</span></div>
        </if>

        <!--分页效果-->
        <div class="table-foot">
            <div class="foot-page">
                <ul><{$page}></ul>
            </div>
        </div>

    </div>
</div>

<!--提示框-->
<div class="pop-window pop-delete" id="info">
    <input type="hidden" name="id" id="id"   >
    <div class="pop-notice FromUpToDown">
        <div class="notice-head">
            <div class="notice-head-title">温馨提示</div>
            <div class="notice-head-delete">×</div>
        </div>
        <div class="notice-content">
            <div>
                <i class="iconfont">&#xe607;</i>
            </div>
            <div class="notice-content-word">是否要删除本条信息？</div>
        </div>
        <div class="notice-foot">
            <a href="javascript:;" onclick="del()" class="notice-btn btn-submit">确定</a>
            <a href="javascript:;" class="notice-btn btn-drop">取消</a>
        </div>
    </div>
</div>

<include file="Public/footer" />

<script>
    //弹出询问框
    function info(id){
        $("#id").val(id);
        $("#info").show();
    }

    //删除
    function del(){
        $('#info').hide();
        var id = $("#id").val();
        $.get(
                "<{:U('del')}>",
                {
                    id:id
                },
                function(res){
                    if(res.status == false){
                        layer.msg(res.info,{time:1000});
                    }else{
                        layer.msg(res.info,{time:1000});
                        setTimeout("location.reload()",1000);
                    }
                }
        );
    }
</script>

<script>
//    发货
function deliver()
{
    // $("#send_mess").show();
    layer.open({
        type: 2,
        title: '发货',
        shadeClose: true,
        shade: 0.8,
        area: ['500px', '443px'],
        content: "<{:U('deliver')}>"
    });
}

$(".dizhi").hover(
			function(){
			if(!$(this).html()){
            return;
        }
		var that = this;
        layer.tips($(this).html(), that, {
            tips: [1, '#F2AA1C'],
            time: 4000
        });
			},
			function(){
			layer.closeAll();
					});

    function writer_no(id){
        layer.confirm('确认已收到寄件？', {
            btn: ['确认','取消'] //按钮
        }, function(){
            $.post(
                    "<{:U('writerNo')}>",
                    {
                        id:id,
                    },function (res){
                        if(res.status == 1){
                            layer.msg(res.info,{time:1000});
                            setTimeout("location.reload()",1000);
                        }else{
                            layer.msg(res.info,{time:1000});
                        }
                    }
            );
        }, function(){
            layer.closeAll();
        });
    }
</script>

</body>
</html>